names = open("E:\\python_learning\\note\\names.txt")


def is_palindrome_recursion(name):
    if len(name) <= 1:
        return True
    else:
        if name[0] != name[-1]:
            return False
        else:
            return is_palindrome_recursion(name[1:-1])


def is_palindrome(name):
    left = 0
    right = len(name) - 1;
    while left < right:
        if name[left] != name[right]:
            return False;
        left += 1
        right -= 1
    return True


for c in names:
    c = c.strip().lower();
    if is_palindrome_recursion(c):
        print(c)

names.close()
